<?php

/**
 *
 * @author Marc André Audet <root@manhim.net>
 * @copyright Copyright(c) 2009-2010 Marc André Audet
 * @license http://www.gnu.org/licenses/gpl.txt The GNU General Public License version 3
 *
 */

?>

<?php

if (!function_exists('L'))
{
	function L($name, &$_T)
	{
		return $_T->This->Language($name);
	}
}

$_T = &$_Template;
$_Tpl = &$_T->GetTemplates();
$_Tpl->Template('Header.tpl.php')->Assign(array('Title' => L('GStats++ 3 - Installation Step 3', $_T)))->Display();

$Uri = $_SERVER['REQUEST_URI'];
$Pos = strpos($Uri, '?');

if ($Pos != false)
{
	$Uri = substr($Uri, 0, $Pos);
}

$Pos = strrpos($Uri, '/');

$Uri = substr($Uri, 0, $Pos + 1);

$FullUrl = $Uri . 'Medias/GStatspp/Default/Install/';

?>


			<div id="Header">

				<div id="HeaderTop">
					<img src="<?=$FullUrl?>Header.png" alt="GStats++" />
				</div>

				<div id="HeaderSteps">
					<span class="NotSelected"><?=L('Step 1 (Agreement)', $_T)?></span> <img src="<?=$FullUrl?>Arrow.png" alt="->" />
					<span class="NotSelected"><?=L('Step 2 (Environment check)', $_T)?></span> <img src="<?=$FullUrl?>Arrow.png" alt="->" />
					<span class="Selected"><?=L('Step 3 (Configuration)', $_T)?></span> <img src="<?=$FullUrl?>Arrow.png" alt="->" />
					<span class="NotSelected"><?=L('Step 4 (Installation)', $_T)?></span>
				</div>

			</div>

			<div id="Content">
				<div id="ContentH1">
					<div id="ContentH2">
						<div class="Content">

							<h1><?=L('GStats++ 3 Installation', $_T)?></h1>

							<h2><?=L('Step 3 (Configuration)', $_T)?></h2>

							<p>We now need some configuration informations in order to initialize the software.</p>

							<form action="?GStatsppInstall/<?=$_T->This->GetLanguage()?>/Step3" method="POST">
							<table class="Configuration">

								<tr>
									<th colspan="2" class="Title">GStats++ Translator Database</th>
								</tr>

								<tr>
									<th width="50%">Database Type</th>
									<td width="50%">
										<select id="databaseSelect">
											<option value="mysql">MySQL</option>
											<option value="mysql-unixsocket">MySQL Unix Socket</option>
										</select>
									</td>
								</tr>

								<tr class="databaseSwitch mysql" style="display: table-row;">
									<th>Hostname</th>
									<td>
										<input type="text" value="localhost" />
									</td>
								</tr>

								<tr class="databaseSwitch mysql" style="display: table-row;">
									<th>Port</th>
									<td>
										<input type="text" value="3306" />
									</td>
								</tr>

								<tr class="databaseSwitch mysql-unixsocket" style="display: none;">
									<th>Path to Socket</th>
									<td>
										<input type="text" /> <img title="The full path to the Unix MySQL socket." class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th>Database name</th>
									<td>
										<input type="text" />
									</td>
								</tr>

								<tr>
									<th>Username</th>
									<td>
										<input type="text" />
									</td>
								</tr>

								<tr>
									<th>Password</th>
									<td>
										<input type="password" />
									</td>
								</tr>

								<tr>
									<th>Maximum inserts per queries</th>
									<td>
										<input type="text" value="250" /> <img title="The maximum number of rows to be added to the database each queries. [1-1000]" class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th>Optimize tables after each updates</th>
									<td>
										<select>
											<option>No</option>
											<option>Yes</option>
										</select> <img title="Run the OPTIMIZE query to each changed tables at the end of the translation sequence." class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th colspan="2" class="Title">GStats++ Translator Configuration</th>
								</tr>

								<tr>
									<th>Allow translation when visiting</th>
									<td>
										<select id="translationSelect">
											<option value="1">Yes</option>
											<option value="0">No</option>
										</select> <img title="Allow the software to run the translation sequence when users are visiting. This might cause some delays to some users while visiting the site and is not the most reliable. It is often called Poor Man's Cron." class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr class="translationSwitch">
									<th>Translation rate (In minutes)</th>
									<td>
										<input type="text" value="60" /> <img title="The mimimum time at which the translation sequence will run again when a user visit (In minutes). [10-10080]" class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th>Allow translation using PHP-Cli (Cronjob, ...)</th>
									<td>
										<select>
											<option value="1">Yes</option>
											<option value="0">No</option>
										</select> <img title="Allow the software to run the translation sequence using PHP-CLI that may be used by Cron or any other services. More informations are in the administration panel." class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th>Allow translation using HTTP/SOAP-like</th>
									<td>
										<select>
											<option value="1">Yes</option>
											<option value="0">No</option>
										</select> <img title="Allow the software to run the translation sequence using an HTTP/SOAP-like call. This may be used by a 3rd party server or a timed script to make an HTTP/SOAP-like call. More informations are in the administration panel." class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th colspan="2" class="Title">First Administrator</th>
								</tr>

								<tr>
									<th>Username</th>
									<td>
										<input type="text" /> <img title="Only alphanumeric caracters are allowed. a-z, A-Z and 0-9. No accents and no special caracters." class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th>Password</th>
									<td>
										<input type="password" /> <img title="Must be at least 6 caracters long." class="ToolTip" src="<?=$FullUrl?>Help.png" alt="Help" />
									</td>
								</tr>

								<tr>
									<th></th>
									<td>
										<input type="password" />
									</td>
								</tr>

							</table>

							<p style="text-align: center;">

								<br /><br />
								<input type="submit" value="Submit the informations" name="submit" />

							</p>

							</form>

						</div>
					</div>
					<div id="ContentBottom"></div>
				</div>
			</div>

<?php

$_Tpl->Template('Footer.tpl.php')->Assign(array('NeedjQuery' => true, 'jQueryPlugins' => array('bgiframe', 'dimensions', 'tooltip'), 'jQueryCode' => "

$('#databaseSelect').change(function() {
	$('.databaseSwitch').css('display', 'none');
	$('.' + $('#databaseSelect').attr('value')).css('display', 'table-row');
});

$('#translationSelect').change(function() {
	if ($('#translationSelect').attr('value') == '0')
	{
		$('.translationSwitch').css('display', 'none');
	}
	else
	{
		$('.translationSwitch').css('display', 'table-row');
	}
});

$('.ToolTip').tooltip({
	showURL: false
});

"))->Display();

?>